Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Encryption In-Transit state as part of the desired state hash sent to clients #2837

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

malayparida2000
Copy link
Contributor

@malayparida2000 malayparida2000 commented Oct 3, 2024

When in-transit encryption is enabled/disabled the kernel mount option for cephFS needs to be updated between prefer-crc/secure. So the desired state hash needs to include the EiT state, so that if the EiT state is changed the desired state hash will change and the client will reconcile to get the updated mount option.

@malayparida2000
Copy link
Contributor Author

/hold for testing

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 2024
@malayparida2000 malayparida2000 changed the title Include EiT state is part of the desired state hash sent to clients Include Encryption In-Transit state as part of the desired state hash sent to clients Oct 3, 2024
@malayparida2000
Copy link
Contributor Author

Should go after #2793

services/provider/server/server.go Outdated Show resolved Hide resolved
services/provider/server/server.go Outdated Show resolved Hide resolved
services/provider/server/server.go Outdated Show resolved Hide resolved
services/provider/server/server.go Outdated Show resolved Hide resolved
services/provider/server/server.go Outdated Show resolved Hide resolved
Copy link
Contributor

openshift-ci bot commented Oct 7, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: malayparida2000
Once this PR has been reviewed and has the lgtm label, please ask for approval from nb-ohad. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@malayparida2000
Copy link
Contributor Author

/retest

2 similar comments
@malayparida2000
Copy link
Contributor Author

/retest

@malayparida2000
Copy link
Contributor Author

/retest

storageCluster := &ocsv1.StorageCluster{}
storageCluster.Name = "test-storagecluster"
storageCluster.Namespace = serverNamespace
assert.NoError(t, client.Create(ctx, storageCluster))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the test for encryption in transit is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this just creates a storagecluster, as I am adding a util function in our code path which expects a storagecluster otherwise it will return an error. This is just to prevent that.

return nil, err
}

desiredClientConfigHash := getDesiredClientConfigHash(channelName, consumerObj, isEncryptionInTransitEnabled(storageCluster.Spec.Network))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line became too long, please split to multiple lines:

Suggested change
desiredClientConfigHash := getDesiredClientConfigHash(channelName, consumerObj, isEncryptionInTransitEnabled(storageCluster.Spec.Network))
desiredClientConfigHash := getDesiredClientConfigHash(
channelName,
consumerObj,
isEncryptionInTransitEnabled(storageCluster.Spec.Network),
)

return nil, err
}

desiredClientConfigHash := getDesiredClientConfigHash(channelName, storageConsumer, isEncryptionInTransitEnabled(storageCluster.Spec.Network))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line became too long, please split to multiple lines:

Suggested change
desiredClientConfigHash := getDesiredClientConfigHash(channelName, storageConsumer, isEncryptionInTransitEnabled(storageCluster.Spec.Network))
desiredClientConfigHash := getDesiredClientConfigHash(
channelName,
storageConsumer,
isEncryptionInTransitEnabled(storageCluster.Spec.Network),
)


return &pb.ReportStatusResponse{
DesiredClientOperatorChannel: channelName,
DesiredConfigHash: desiredClientConfigHash,
}, nil
}

func getDesiredClientConfigHash(channelName string, storageConsumer *ocsv1alpha1.StorageConsumer) string {
func getDesiredClientConfigHash(channelName string, storageConsumer *ocsv1alpha1.StorageConsumer, inTransitEncryptionEnabled bool) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The correct term is EncryotionInTransi which is EiT not inTransitEncryption
  2. There is no need to mention Enabled for a boolean param, it does not add anything to the readability and just makes the name longer
Suggested change
func getDesiredClientConfigHash(channelName string, storageConsumer *ocsv1alpha1.StorageConsumer, inTransitEncryptionEnabled bool) string {
func getDesiredClientConfigHash(channelName string, storageConsumer *ocsv1alpha1.StorageConsumer, encryptionInTransit bool) string {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have addressed all the conversations along with this one, PTAL.

}

var foundSc *ocsv1.StorageCluster

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add empty lines, which all of the lines below belong to the same logical unit

Suggested change

}
foundSc = sc
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as last comment

Suggested change

@nb-ohad
Copy link
Contributor

nb-ohad commented Oct 8, 2024

@malayparida2000 Please let the reviewers resolve review comments threads.
A reviewer must validate the changes made after you fix/change anything. We usually use the resolve state of a thread as confirmation that the change was made or the conversation resulted in a resolution that satisfies the reviewer, so the correct person to resolve a review comment thread is the reviewer after confirmation

When Encryption in-transit(EiT) is enabled/disabled the kernel mount
option for cephFS needs to be updated between prefer-crc/secure. So the
desired state hash needs to include the EiT state, so that
if the EiT state is changed the desired state hash will change and
the client will reconcile to get the updated mount option.

Signed-off-by: Malay Kumar Parida <[email protected]>
@malayparida2000
Copy link
Contributor Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants